//
//  STDSRenderer.h
//  STDRenderSDK
//
//  Created by 陈学明 on 2023/3/14.
//

#import <Foundation/Foundation.h>
#import "STDSGLParam.h"
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN

@class STDSRenderer;

@interface STDSRenderer : NSObject
@property (nonatomic, assign) CGFloat duration; /// 持续时间，默认5s
///
/// 创建引擎，默认初始化的时候创建引擎
- (void)createRenderEngine;
/// 销毁引擎
- (void)destroyRenderEngine;
/// 设置合成大小
- (void)setComposeSizeSRC:(CGSize)size;
/// 设置进度并渲染
- (void)renderPrograss:(CGFloat)prograss;
/// 读取pixel
- (void)readPixelOfPrograss:(CGFloat)prograss width:(int *)width height:(int *)height data:(unsigned char **)data;

- (void)testGL;

//// ------------ 图层相关
/// 通过图片地址添加一个图片层
- (STDSGLImageParam *)addImageLayerWithImagePath:(NSString *)imagePath;
/// 添加一个固态层
- (STDSGLSolidParam *)addSolidLayerWithColorRed:(float)red green:(float)green blue:(float)blue;

/// 添加一个预合成层
- (STDSGLCompseParam *)addCompose;
- (STDSGLCompseParam *)addComposeLayerWithWidth:(CGFloat)width height:(CGFloat)height;

/// 通过纹理ID添加一个图片层
- (STDSGLImageParam *)addImageLayerWithTextureID:(unsigned int)textureID width:(CGFloat)width height:(CGFloat)height;

/// 选中预合成，穿0时表示表中默认预合成
- (void)selectCompose:(int)composeId;

- (void)moveLayerToCompose:(int)layerId composeID:(int)composeId;

/// 选择图层
- (void)selectLayer:(int)layerId;

/// 移除图层
- (void)removeLayer:(int)layerId;

/// 替换资源
- (void)replaceParam:(STDSGLParam *)param;
- (void)replaceLayerAssetImgPath:(NSString *)path;
- (void)replaceLayerTextureID:(unsigned int)textureID width:(CGFloat)width height:(CGFloat)height;
- (void)replaceLayerData:(unsigned char *)data width:(CGFloat)width height:(CGFloat)height;

- (void)replaceLayerMaskTextureID:(unsigned int)textureID width:(CGFloat)width height:(CGFloat)height;
- (void)replaceLayerMaskPath:(NSString *)path;
- (void)replaceLayerMaskData:(unsigned char *)data width:(CGFloat)width height:(CGFloat)height;
/// ------------ 在最原始的基础上进行变换
/// 设置图层大小
- (void)setLayerSize:(CGSize)size;
/// 设置图层中心点位置
- (void)setLayerCenter:(CGPoint)center;
/// 设置图层旋转
- (void)setLayerRotate:(CGFloat)rotate;
/// 设置图层缩放比例
- (void)setLayerScale:(CGSize)scale;
/// 设置图层透明度
- (void)setLayerAlpha:(CGFloat)alpha;
/// 显示或隐藏图层
- (void)setLayerVisible:(BOOL)isVisible;
/// 将图层移动到最上面
- (void)moveLayerToTop;
/// 将图层移动到最下面
- (void)moveLayerToBottom;
/// 移动到 targetLayerID 图层之上
- (void)moveLayerToFront:(int)targetLayerID;
/// 移动到 targetLayerID 图层之下
- (void)moveLayerToBack:(int)targetLayerID;


/// ------------ 仿射变换,会在上一次变换的基础上进行变化
/// 平移
- (void)translationLayer:(CGVector)point;
/// 旋转
- (void)rotationLayer:(CGFloat)rotation;
/// 缩放
- (void)scaleLayer:(CGVector)scale;

/// 设置图层混合 模式
- (void)setBlend:(STDSBlendType)blendType;

/// ------------ 效果相关
/// 添加效果
- (void)addEffectType:(STDSEffectType)effectType;
/// 移除效果
- (void)removeEffect:(STDSEffectType)effectType;
/// 设置效果参数
- (void)changeEffectArguments:(STDSEffectType)effectType name:(NSString *)name floatValue:(float *)floatValue count:(int)n;
- (void)changeEffectArguments:(STDSEffectType)effectType name:(NSString *)name floatValue:(float)floatValue;
/// 设置参数
- (void)changeEffectArguments:(STDSEffectType)effectType name:(NSString *)name intValue:(int *)intValue count:(int)n;
- (void)changeEffectArguments:(STDSEffectType)effectType name:(NSString *)name intValue:(int)intValue;
/// 设置参数
- (void)changeEffectArguments:(STDSEffectType)effectType name:(NSString *)name stringValue:(NSString *)stringValue;
/// 设置位图
- (void)changeEffectArguments:(STDSEffectType)effectType name:(NSString *)name data:(const char *)data width:(int)width height:(int)height;
- (void)changeEffectArguments:(STDSEffectType)effectType name:(NSString *)name textureID:(unsigned int)textureID width:(int)width height:(int)height;
/// 显示/隐藏效果
- (void)setVisibleOfEffect:(STDSEffectType)effectType visible:(BOOL)isVisible;

// 校验状态
- (BOOL)checkerStatus:(STDSEffectType)effectType label:(NSString *)label;

/// ------------ 热加载效果相关
- (void)addHotEffect:(NSString *)effectName path:(NSString *)path;
/// 移除热加载效果
- (void)removeHotEffect:(NSString *)effectName;
/// 设置热加载效果参数
- (void)changeHotEffectArguments:(NSString *)effectName name:(NSString *)name floatValue:(float *)floatValue count:(int)n;
- (void)changeHotEffectArguments:(NSString *)effectName name:(NSString *)name floatValue:(float)floatValue;

- (void)changeHotEffectArguments:(NSString *)effectName name:(NSString *)name intValue:(int *)intValue count:(int)n;
- (void)changeHotEffectArguments:(NSString *)effectName name:(NSString *)name intValue:(int)intValue;

- (void)changeHotEffectArguments:(NSString *)effectName name:(NSString *)name stringValue:(NSString *)stringValue;
/// 显示/隐藏热加载效果
- (void)setVisibleOfHotEffect:(NSString *)effectName visible:(BOOL)isVisible;

/// ------------ 热加载滤镜
- (void)addHotFilter:(NSString *)filterName path:(NSString *)path;

- (void)removeHotFilter:(NSString *)filterName;

- (void)changeHotFilterArguments:(NSString *)filterName effectName:(NSString *)effectName name:(NSString *)name floatValue:(float *)floatValue count:(int)n;

- (void)changeHotFilterArguments:(NSString *)filterName effectName:(NSString *)effectName name:(NSString *)name floatValue:(float)floatValue;

- (void)changeHotFilterArguments:(NSString *)filterName effectName:(NSString *)effectName name:(NSString *)name intValue:(int *)intValue count:(int)n;

- (void)changeHotFilterArguments:(NSString *)filterName effectName:(NSString *)effectName name:(NSString *)name intValue:(int)intValue;

- (void)changeHotFilterArguments:(NSString *)filterName effectName:(NSString *)effectName name:(NSString *)name stringValue:(NSString *)stringValue;
/// 显示/隐藏热加载效果
- (void)setVisibleOfHotFilter:(NSString *)filterName visible:(BOOL)isVisible;
@end

NS_ASSUME_NONNULL_END
